<template>
  <div>
    <el-popover placement="right"
                width="900"
                trigger="click">
      <el-table :data="gridData">
        <el-table-column label="学号"
                         property="studentNumber"></el-table-column>
        <el-table-column label="姓名"
                         property="name"></el-table-column>
        <el-table-column label="性别"
                         property="sex"></el-table-column>
        <el-table-column label="学院"
                         property="college"></el-table-column>
        <el-table-column label="班级"
                         property="class"></el-table-column>
        <el-table-column label="所在楼宇"
                         property="tower"></el-table-column>
        <el-table-column label="宿舍号"
                         property="dorm"></el-table-column>
        <el-table-column label="电话"
                         property="tel"></el-table-column>
      </el-table>
      <el-button slot="reference"
                 type="primary"
                 size="small">本宿舍学生</el-button>
    </el-popover>
  </div>

</template>

<script>

export default {
  name: 'dormStudents',
  props: {
    dormInfo: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  data () {
    return {
      gridData: []
    }
  },

  methods: {
    // 获取宿舍学生信息
    async getCurrStudentsInfo () {
      console.log(this.dormInfo)
      const { data: res } = await this.$axios.get('/student/myDormInfo', {
        params: {
          tower: this.dormInfo.tower,
          dorm: this.dormInfo.dorm
        }
      })
      if (res.meta.code === 200) {
        // this.$message.success(res.meta.msg)
        this.gridData = res.result
      } else {
        this.$message.error(res.meta.msg)
      }
    }
  }
}

</script>
<style lang='' scoped>
</style>
